home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 20 code / Pict Tricks / CLUTLess / SimpleInC.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-28  |  2.6 KB  |  107 lines  |  [TEXT/MMCC]

  1.  
  2. /*     
  3.                             CLUTLess
  4.             In some instances it is desireable to store picts stripped of
  5.             CLUTs in order to save some room in the disk. This sample shows
  6.             how to create such picts and how to properly display them back.
  7.             
  8.             SimpleInC.c -- initialization stuff and event loop
  9.             CLUTLess.c  -- code that does the creation of the clut less pict;
  10.                            shows also how to display the pictures.
  11.     
  12. */
  13.  
  14. /* all the includes we need. */
  15. #include <Desk.h>
  16. #include <Fonts.h>
  17. #include <Memory.h>
  18. #include <Resources.h>
  19. #include <StandardFile.h>
  20. #include <ToolUtils.h>
  21.  
  22. /*
  23.  * Resource ID constants.
  24.  */
  25.  
  26. #define    appleID            128             /* This is a resource ID */
  27. #define    fileID             129             /* ditto */
  28. #define    editID             130             /* ditto */
  29. #define stuffID            131                /* same */
  30.  
  31. #define    appleMenu        0                /* MyMenus[] array indexes */
  32. #define    aboutMeCommand    1
  33.  
  34. #define    fileMenu        1
  35. #define printCommand    1
  36. #define pageCommand        2
  37. #define    quitCommand     3
  38.  
  39. #define    editMenu        2
  40. #define    undoCommand     1
  41. #define    cutCommand        3
  42. #define    copyCommand     4
  43. #define    pasteCommand    5
  44. #define    clearCommand    6
  45.  
  46. #define stuffMenu        3
  47. #define mUnmodPict        1
  48. #define mNoClutPict        2
  49. #define mClutPict        3
  50.  
  51. #define menuCount         4
  52. /*
  53.  * For the one and only text window
  54.  */
  55. #define windowID        128
  56. /*
  57.  * For DLOG's
  58.  */
  59. #define    aboutMeDLOG        128
  60.  
  61. #define    okButton        1
  62. #define    authorItem        2            /* For SetIText */
  63. #define    languageItem    3            /* For SetIText */
  64.  
  65. #define SETRECT(rectp, _left, _top, _right, _bottom)    \
  66.     (rectp)->left = (_left), (rectp)->top = (_top),     \
  67.     (rectp)->right = (_right), (rectp)->bottom = (_bottom)
  68.  
  69. #define HIWORD(aLong)        (((aLong) >> 16) & 0xFFFF)
  70. #define LOWORD(aLong)        ((aLong) & 0xFFFF)
  71.  
  72.  
  73. /*
  74.  * Global Data objects, used by routines external to main().
  75.  */
  76. MenuHandle        MyMenus[menuCount];     /* The menu handles */
  77. Boolean         DoneFlag;                /* Becomes TRUE when File/Quit chosen */
  78. TEHandle        TextH;                    /* The TextEdit handle */
  79.  
  80. WindowRecord    wRecord;
  81. WindowPtr        myWindow;            /* Referenced often */
  82.  
  83. Rect             pFrame;
  84.  
  85. CQDProcs         myProcs;
  86.  
  87.     
  88. extern         PicHandle gOrigPict;             // Holds the original picture
  89. extern         PicHandle gModPict;                 // for the modified picture
  90. extern         PicHandle gCurrPict;                // pict to be used when updating the window
  91.  
  92. CTabHandle     gSharedClut;                         // we use this to create the 'clut' resource
  93.                                             // later we use it for reading in the 'clut'
  94.  
  95. /* protos */
  96.  
  97. /* SimpleInC.c */
  98. void setupMenus(void);
  99. void showAboutMeDialog(void);
  100. void doCommand(long mResult);
  101.  
  102. /* clutless.c */
  103. extern Boolean         SetupPictures(void);
  104. extern pascal void     AddColor(BitMap *src, Rect *srcR, Rect *dstR, short mode, RgnHandle msk);
  105. extern void         InitProcs(CQDProcs *theProcs);
  106.  
  107.